//
//  LJHThreeCollectionViewCell.m
//  HEARME
//
//  Created by 曲政永 on 16/1/21.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LJHThreeCollectionViewCell.h"
#import "UIImageView+WebCache.h"
@interface LJHThreeCollectionViewCell ()

@property(nonatomic,retain)UILabel *nameLable;
@property(nonatomic,retain)UIImageView *myImageView;
@property(nonatomic,retain)UILabel *cataLable;

@end

@implementation LJHThreeCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self createCell];
    }
    return self;
}
-(void)createCell
{
    self.myImageView = [[UIImageView alloc]initWithFrame:CGRectMake(self.contentView.frame.origin.x, self.contentView.frame.origin.y, self.contentView.frame.size.width, self.contentView.frame.size.height-self.contentView.frame.size.height/3)];
    self.myImageView.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:self.myImageView];
    
    self.nameLable = [[UILabel alloc]initWithFrame:CGRectMake(0, self.myImageView.frame.size.height-20, self.myImageView.frame.size.width,20 )];
//    self.nameLable.backgroundColor = [UIColor blackColor];
    [self.contentView addSubview:self.nameLable];
//    self.nameLable.alpha = 0.5;
    
    
    
    self.cataLable = [[UILabel alloc]initWithFrame:CGRectMake(0, 120,self.myImageView.frame.size.width,100 )];
//    self.cataLable.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.cataLable];
    self.cataLable.alpha = 1;

    
    
}

-(void)setTextModel:(LJHChildListModel *)textModel
{
    if (_textModel != textModel) {
        [_textModel release];
        _textModel = [textModel retain];
    }
    NSURL *url = [NSURL URLWithString:self.textModel.coverLarge];
    [self.myImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"1024.jpg"]];
    
    self.nameLable.text = _textModel.title;
    self.nameLable.font = [UIFont systemFontOfSize:14];
    self.nameLable.textColor = [UIColor whiteColor];
    
    self.cataLable.text = _textModel.trackTitle;
    self.cataLable.font = [UIFont systemFontOfSize:15];
//    self.cataLable.backgroundColor = [UIColor redColor];
    self.cataLable.lineBreakMode = NSLineBreakByWordWrapping;
    self.cataLable.numberOfLines = 2;

    [self.cataLable sizeToFit];
    
}
-(void)setThreeModel:(LJHAnchorThreeModel *)threeModel
{
    if (_threeModel!=threeModel) {
        [_threeModel release];
        _threeModel = [threeModel retain];
    }
//    NSLog(@"%@",_threeModel.nickname);
    NSURL *url = [NSURL URLWithString:self.threeModel.smallLogo];
    [self.myImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"1024.jpg"]];
    
//    self.nameLable.text = _threeModel.nickname;
//    self.nameLable.font = [UIFont systemFontOfSize:14];
//    self.nameLable.textColor = [UIColor blackColor];
    
    
    self.cataLable.text = _threeModel.nickname;
    self.cataLable.font = [UIFont systemFontOfSize:15];
    //    self.cataLable.backgroundColor = [UIColor redColor];
    
    self.cataLable.textAlignment = NSTextAlignmentCenter;
    [self.cataLable sizeToFit];

    
}
@end
